
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>发送失败的的用户</title>


    <link rel="shortcut icon" href="favicon.ico">
    <link href="https://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/font-awesome/4.4.0/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <!-- Data Tables -->
    <link href="/Public/Admin/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <link href="/Public/Admin/css/style.min.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>发送失败的用户
                        <small>用户列表</small>
                    </h5>

                </div>
                <div class="ibox-content">

                    <div>
                        <form role="form" class="form-inline">
                            <div class="form-group">
                                <label for="game" class="sr-only">游戏标识</label>
                                <input name="game" type="text" placeholder="游戏标识" id="game" class="form-control">
                            </div>
                            <div class="form-group">
                                <label for="table" class="sr-only">数据表</label>
                                <input name="table" type="text" placeholder="数据表" id="table" class="form-control">
                            </div>
                            <div class="form-group">
                                <button class="btn btn-white" type="button" onClick="save()">登录</button>
                            </div>

                        </form>
                    </div>

                    <table class="table table-striped table-bordered table-hover dataTables-example" style="margin-top: 20px;">
                        <thead>
                        <tr>
                            <th>序号</th>
                            <th>用户opendi</th>
                            <th>游戏</th>
                            <th>数据表</th>
                            <th>时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        
                      	<?php 
                        
                        	if(! empty($data['fail_data']))
                            {
                            	foreach($data['fail_data'] as $key => $val)
                                {
                        ?>
                        <tr class="gradeX">
                            <td>{++$key;}</td>
                            <td class="center">{$val['touser']}</td>
                            <td class="center">{$val['game']}</td>
                            <td class="center">{$val['table']}</td>
                            <td class="center"><?php  echo date('Y-m-d H:i:s',$val['create_time']); ?></td>
                        </tr>
                        
                        
                        <?php
                        		}
                            }    
                        ?>
                        


                        </tbody>
                        
                    </table>

                </div>
            </div>
        </div>
    </div>

</div>

<script src="https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/Public/Admin/js/contabs.min.js?v=1.0"></script>
<script src="/Public/Admin/js/plugins/layer/layer.js?v=1.0"></script>
<script>

    var lock = 0;
    function save()
    {
        if(lock == 1){ return false;}
        var url = "{:U('PushMessage/fail_user')}";
        $.ajax({
            type : 'post',
            url  : url+'?t='+Math.random(),
            data : $("form").serialize(),
            dataType : 'json',
            beforeSend: function(){
                lock = 1;
            },
            success : function(res){
                layer.closeAll();
                if(res.state > 0){
                    layer.msg('同步成功', {icon: 1});
                    var t = window.setTimeout("reload()",2000);

                }else{
                    layer.msg(res.error, {icon: 2});
                }
            },
            complete: function(){
                lock = 0;
            },
            error : function(XMLHttpRequest, textStatus, errorThrown) {
                layer.closeAll();
                layer.msg('网络失败，请刷新页面后重试', {icon: 2});
            }
        })
    }


    function reload()
    {
        //document.location.reload();//当前页面
        location.href = "{:U('PushMessage/fail_user')}?";
    }

</script>

</body>

</html>
